home *** CD-ROM | disk | FTP | other *** search
- Path: solon.com!not-for-mail
- From: ferguson@col.hp.com (Scott Ferguson)
- Newsgroups: comp.lang.c,comp.lang.c.moderated,hp.unix,comp.sys.hp.apps,comp.sys.hp.hpux
- Subject: Re: C coding problem
- Followup-To: comp.lang.c,comp.lang.c.moderated,hp.unix,comp.sys.hp.apps,comp.sys.hp.hpux
- Date: 3 Apr 1996 19:04:47 -0600
- Organization: HP Colorado Springs Division
- Sender: clc@solutions.solon.com
- Approved: clc@solutions.solon.com
- Message-ID: <4jv77f$cu8@solutions.solon.com>
- References: <4ianbf$h86@solutions.solon.com> <4iemcl$a05@solutions.solon.com> <4io1io$no4@solutions.solon.com> <4j41ru$nq4@solutions.solon.com> <4jttlq$3p1@solutions.solon.com>
- NNTP-Posting-Host: solutions.solon.com
- X-Newsreader: TIN [version 1.2 PL2]
-
- I would hope by now that HP's C compiler has a fairly good degree of
- optimization built in, to the point that most cases of this:
-
- for (i=0;i<n;i++) x[i] = y[i]*z[i];
-
- should perform as quickly as:
-
- xp = x;
- yp = y;
- zp = z;
- endp = &x[n];
-
- while (xp < endp) *(xp++) = (*yp++) * (*zp++);
-
- In my former life, I worked on supercomputers, and the ONLY way to get
- decent performance out of C code was to use arrays whenever possible,
- otherwise the compiler which was built to maximize use of available
- hardware acceleration could tell what you were trying to do. So where
- do our compilers stand on this? If PA-RISC has some superscalar ops like
- multiply-add in a single clock, I'd rather give the compiler enough high-level
- language to optimize to what's best for the hardware.
-
- I haven't worked with HP's C enough to know. If you already hashed this
- out while I wasn't reading the thread, sorry.
-
-
- --
- -----------------------------------------------------------------------------
- Scott Ferguson Solely my opinions
- Hewlett-Packard Co. Colorado Springs, CO
- ftp://col.hp.com/html/ferguson/index.html
-